package io.renren.common.utils;

import java.util.List;

import com.xiaoleilu.hutool.util.CollectionUtil;
import com.xiaoleilu.hutool.util.StrUtil;

public enum ItemEnum2 {

	ZUJIN("租金", "ifnull(stotal_price,0)"), GUANLI("管理费", "ifnull(stotal_manage,0)"), WUYE("物业费",
			"ifnull(stotal_property,0)"), NENGHAO("公共能耗费", "ifnull(stotal_energy,0)"), BAOZHENG("保证金",
					"ifnull(stotal_bond,0)"), JUJIAN("居间服务费", "ifnull(stotal_inter,0)"), QITA1("租场费",
							"ifnull(stotal_other1,0)"), TINGCHE("停车费", "ifnull(stotal_stop,0)"), QITA("其他",
									"ifnull(stotal_other,0)"), FANZU("返租租金", "ifnull(total_lprice,0)");
	private String name;
	private String value;

	ItemEnum2(String name, String value) {
		this.name = name;
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static ItemEnum2 getItem(String value) {
		for (ItemEnum2 examType : ItemEnum2.values()) {
			if (value.equals(examType.getName())) {
				return examType;
			}
		}
		return null;
	}

	public static String getItemList(String names) {
		String[] name = StrUtil.split(names, ",");
		List<String> values = CollectionUtil.newArrayList();
		for (String string : name) {
			values.add(getItem(string).getValue());
		}
		if (!values.isEmpty()) {
			return CollectionUtil.join(values, "+");
		}
		return null;
	}

	public static void main(String[] args) {
		System.out.println(getItemList("租金,物业费"));
	}
}
